home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 …ember: Reference Library / Dev.CD Dec 00 RL Disk 1.toast / pc / technical documentation / develop / develop issue 28 / develop issue 28 code / sketch / source / adts / structs.h < prev   
Encoding:
C/C++ Source or Header  |  1996-08-23  |  6.4 KB  |  218 lines

  1. /****************************************************************************
  2.  * 
  3.  * Structs.h
  4.  * 
  5.  * Public functions, structures and constants
  6.  *
  7.  ****************************************************************************/
  8.  
  9. #ifndef __STRUCTS__
  10. #define __STRUCTS__
  11.  
  12. #include <QDOffscreen.h>
  13.  
  14. // Sketch colors as RGB colors
  15.  
  16. #define     kRGBBlack             {0x0000, 0x0000, 0x0000}                        
  17. #define  kRGBWhite             {0xFFFF, 0xFFFF, 0xFFFF}
  18.  
  19. #define  kRGBRed              {0xFFFF, 0x0000, 0x0000}
  20. #define  kRGBGreen            {0x0000, 0xFFFF, 0x0000}
  21. #define  kRGBBlue              {0x0000, 0x0000, 0xFFFF}
  22.  
  23. #define  kRGBCyan              {0x0000, 0xFFFF, 0xFFFF}
  24. #define  kRGBMagenta            {0xFFFF, 0x0000, 0xFFFF}
  25. #define  kRGBYellow            {0xFFFF, 0xFFFF, 0x0000}
  26.  
  27. #define  kRGBOlive             {0x0000, 0x64AF, 0x11B0}
  28. #define  kRGBPurple            {0xF2D7, 0x0856, 0x84EC}
  29. #define     kRGBOrange             {0xD2D2, 0x7171, 0x4343}                        
  30. #define     kRGBBrown              {0x7A7A, 0x4646, 0x4242}                        
  31.  
  32. #define  kRGBGray01            {0xF000, 0xF000, 0xF000}
  33. #define  kRGBGray02              {0xE000, 0xE000, 0xE000}
  34. #define  kRGBGray03             {0xD000, 0xD000, 0xD000}
  35. #define  kRGBGray04            {0xC000, 0xC000, 0xC000}
  36. #define  kRGBGray05              {0xB000, 0xB000, 0xB000}
  37. #define  kRGBGray06             {0xA000, 0xA000, 0xA000}
  38. #define  kRGBGray07            {0x9000, 0x9000, 0x9000}
  39. #define  kRGBGray08              {0x8000, 0x8000, 0x8000}
  40. #define  kRGBGray09             {0x7000, 0x7000, 0x7000}
  41. #define  kRGBGray10            {0x6000, 0x6000, 0x6000}
  42. #define  kRGBGray11              {0x5000, 0x5000, 0x5000}
  43. #define  kRGBGray12             {0x4000, 0x4000, 0x4000}
  44. #define  kRGBGray13            {0x3000, 0x3000, 0x3000}
  45. #define  kRGBGray14              {0x2000, 0x2000, 0x2000}
  46. #define  kRGBGray15             {0x1000, 0x1000, 0x1000}
  47. #define  kRGBGray16            {0x0001, 0x0001, 0x0001}
  48.  
  49. // Sketch enums used in the 'aete' resource
  50.  
  51. #define eBlack            'BLAC'
  52. #define eWhite            'WHIT'
  53.  
  54. #define eRed            'RED '
  55. #define eGreen            'GREE'
  56. #define eBlue            'BLUE'
  57.  
  58. #define eCyan            'CYAN'
  59. #define eMagenta        'MAGE'
  60. #define eYellow        'YELL'
  61.  
  62. #define eOlive            'OLIV'
  63. #define ePurple        'PURP'
  64. #define eOrange        'ORAN'
  65. #define eBrown            'BROW'
  66.  
  67. #define eGray01        'GR01'
  68. #define eGray02        'GR02'
  69. #define eGray03        'GR03'
  70. #define eGray04        'GR04'
  71. #define eGray05        'GR05'
  72. #define eGray06        'GR06'
  73. #define eGray07        'GR07'
  74. #define eGray08        'GR08'
  75. #define eGray09        'GR09'
  76. #define eGray10        'GR10'
  77. #define eGray11        'GR11'
  78. #define eGray12        'GR12'
  79. #define eGray13        'GR13'
  80. #define eGray14        'GR14'
  81. #define eGray15        'GR15'
  82. #define eGray16        'GR16'
  83.  
  84. #ifndef topLeft
  85.     #define topLeft(r)                (((Point *) &(r))[0])
  86. #endif
  87.  
  88. #ifndef botRight
  89.     #define botRight(r)                (((Point *) &(r))[1])
  90. #endif
  91.  
  92. #ifndef max
  93.     #define    max(a, b)                (((a) > (b)) ? (a) : (b))
  94. #endif
  95.  
  96. #ifndef min
  97.     #define    min(a, b)                 (((a) < (b)) ? (a) : (b))
  98. #endif
  99.  
  100. // --------------------------------------------------------------------------
  101.  
  102. typedef enum StructureTypes
  103. {
  104.     kDocumentRecordID                = '*DOC',
  105.     kElementRecordID                = '*ELM',
  106.     
  107.     kDocumentListID                = '#DOC',
  108.     kElementListID                    = '#ELM'
  109. } StructureType;
  110.  
  111. // --------------------------------------------------------------------------
  112.  
  113. typedef enum DocumentTypes
  114. {
  115.     kInvalidDocument        = 'XXXX',
  116.     kEtchDocument            = 'ETCH'    
  117. } DocumentType;
  118.  
  119. // --------------------------------------------------------------------------
  120.  
  121. typedef enum ElementTypes
  122. {
  123.     kQDLine                    = 'LINE',
  124.     kQDRect                    = 'RECT',
  125.     kQDRoundRect            = 'ROUN',
  126.     kQDOval                 = 'OVAL',
  127.     kQDPolygon                = 'POLY',
  128.     kGroup                    = 'GRUP',
  129.     kUnknownElement        = 'XXXX'
  130. } ElementType;
  131.  
  132. #pragma mark -
  133. // ------------------------------------------------------------------------------------------------------------
  134.  
  135. #if powerc
  136.     #pragma options align=power
  137. #endif
  138.  
  139.  
  140. // -------------------------------------------------------------------------------------------
  141. //                                      Utility structs
  142. // -------------------------------------------------------------------------------------------
  143.  
  144. typedef struct DrawingState
  145. {
  146.     WindowPtr    window;
  147.     PenState        penState;
  148.     RGBColor        foreColor;
  149.     RGBColor        backColor;
  150. } DrawingState;
  151.  
  152. // -------------------------------------------------------------------------------------------
  153. //                                      ELEMENTS
  154. // -------------------------------------------------------------------------------------------
  155.  
  156. typedef struct StrokeRecord
  157. {
  158.     StructureType                    structID;    
  159.     RGBColor                            rgbColor;
  160.     short                                penWidth;
  161.     short                                penHeight;
  162. } StrokeRecord;
  163.  
  164. typedef struct FillRecord
  165. {
  166.     StructureType                    structID;    
  167.     RGBColor                            rgbColor;
  168. } FillRecord;
  169.  
  170.  
  171. typedef struct ElementRecord
  172. {
  173.     StructureType                    structID;                                                
  174.     unsigned long                    elementNumber;                // unqiuely identifies each element within each element list
  175.     struct ElementRecord          **next;                        // reference to next element in list, or nil if last ad
  176.     struct ElementRecord          **previous;                    // reference to previous element in list, or nil if first ad
  177.     struct ElementRecord          **subElementList;            // reference to sub element, or nil if none
  178.     ElementType                        elementType;                // type of element 
  179.     Rect                                boundingBox;                // bounding box in window coordinates
  180.     Point                                roundRectOvalSize;        // width & height of oval used to create round corners    
  181.     Point                                line[2];                        // start and stop points for a line
  182.     PolyHandle                        polygon;                        // polygon data
  183.     StrokeRecord                    strokeInfo;                    // stroke data
  184.     FillRecord                        fillInfo;                    // fill data
  185. } ElementRecord, **ElementReference;
  186.  
  187. typedef ElementReference ElementList;
  188.  
  189. // -------------------------------------------------------------------------------------------
  190. //                                    DOCUMENTS
  191. // -------------------------------------------------------------------------------------------
  192.  
  193. typedef struct DocumentRecord
  194. {
  195.     StructureType                    structID;                    // x defines type of structure for debugging and run-time type checking
  196.     unsigned long                    documentNumber;            // x sequential document number, for debugging only
  197.     DocumentType                    documentType;                // • Ad, Text, Picture, TIFF, etc
  198.     Str63                                documentName;                // • document name, always accurate!
  199.  
  200.     struct DocumentRecord     **next;                            // x reference to next document
  201.     struct DocumentRecord     **previous;                    // x reference to previous document
  202.  
  203.     unsigned short                    numberOfChanges;            // x zero if no changes by user, else number of changes user has made
  204.     
  205.     WindowPtr                        window;                        // x window reference
  206.     ElementList                        elementList;
  207.     short                                maxWidth;                    // x maximum width of document
  208.     short                                maxHeight;                    // x maximum height of document
  209. } DocumentRecord, **DocumentReference;
  210.  
  211. typedef DocumentReference    DocumentList;
  212.  
  213. #if powerc
  214.     #pragma options align=reset
  215. #endif
  216.  
  217. #endif
  218.